package cc.eddic.practice.spring.dto;


import cc.eddic.practice.spring.domain.Option;
import cc.eddic.practice.spring.domain.Question;
import cc.eddic.practice.spring.domain.QuestionType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.val;
import org.springframework.beans.BeanUtils;

import java.time.LocalDateTime;
import java.util.List;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class QuestionResponse {
    private long id;

    private int no;
    private String description;
    private QuestionType questionType;
    private List<Option> options;
    private Object image;

    private LocalDateTime createdOn;
    private LocalDateTime updatedOn;
    private Integer version;

    public static QuestionResponse from(final Question question){
        val dto=new QuestionResponse();
        BeanUtils.copyProperties(question,dto);
        return dto;
    }
}
